<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['异常警报','设备离线查询']" icon="fa fa-exclamation-circle" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>设备离线查询</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<sa-company-tree-car companyTreeId="companyTree" [isShowCarSort]="true" (companySelected)="companySelected($event)"></sa-company-tree-car>
							<div class="left page-header-btn" style="width: calc(100% - 220px);" *ngIf="TabType == 'deviceOffline'">
								<div class="top_module">
									<span class="module_text">离线时长</span>
									<select name="" id="" class="module_inp" [(ngModel)]="offline.offlineTime"  >
										<option value="3600">1小时以上</option>
										<option value="43200">12小时以上</option>
										<option value="86400">24小时以上</option>
										<option value="432000">5天以上</option>
										<option value="864000">10天以上</option>
									</select>
								</div>
								<div class="top_module">
									<span class="module_text">有无磅单</span>
									<select name="" id="" class="module_inp" [(ngModel)]="offline.weightType" >
										<option value="">全部</option>
										<option value="0">有磅单</option>
										<option value="1">无磅单</option>
									</select>
								</div>
								<div class="top_module">
									<span class="module_text">排序条件</span>
									<select name="" id="" class="module_inp" [(ngModel)]="offline.sortType" >
										<option value="">默认</option>
										<option value="1">磅单数量</option>
										<option value="2">离线时间</option>
										<option value="3">安装时间</option>
									</select>
								</div>
								<div class="top_module">
									<span class="module_text">排序条件</span>
									<select name="" id="" class="module_inp" [(ngModel)]="offline.sortTime" >
										<!--<option value="">默认</option>-->
										<option value="1">升序</option>
										<option value="2">降序</option>
									</select>
								</div>
								
								<div class="top_module">
									<span class="module_text">时间类型</span>
									<select name="" id="" class="module_inp" [(ngModel)]="offline.dateType"  >
										<option value="0">安装时间</option>
										<option value="1">离线时间</option>
									</select>
								</div>
								<div class="selectDate top_module">
									<table-select-date [notInit]='true' (outerTime)="getSelectTableTime($event)" ></table-select-date>
								</div>
								<button type="button" class="btn btn-primary" (click)="table_search()">查询</button>
								<button type="button" class="btn btn-primary" (click)="dataExceport()">导出</button>
							</div>
							<div class="left page-header-btn" style="width: calc(100% - 220px);" *ngIf="TabType == 'gpsError'">
								<div class="top_module">
									<span class="module_text">GPS异常时长</span>
									<select name="" id="" class="module_inp" [(ngModel)]="gps.offlineTime"  >
										<option value="600">10分钟以上</option>
										<option value="1800">30分钟以上</option>
										<option value="3600">1小时以上</option>
										<option value="43200">12小时以上</option>
										<option value="86400">1天以上</option>
									</select>
								</div>
								<div class="top_module">
									<span class="module_text">排序条件</span>
									<select name="" id="" class="module_inp" [(ngModel)]="gps.sortType" >
										<option value="">默认</option>
										<option value="1">GPS时间</option>
										<option value="2">安装时间</option>
									</select>
								</div>
								<div class="top_module">
									<span class="module_text">排序条件</span>
									<select name="" id="" class="module_inp" [(ngModel)]="gps.sortTime" >
										<!--<option value="">默认</option>-->
										<option value="1">升序</option>
										<option value="2">降序</option>
									</select>
								</div>
								
								<div class="top_module">
									<span class="module_text">时间类型</span>
									<select name="" id="" class="module_inp" [(ngModel)]="gps.dateType"  >
										<option value="1">安装时间</option>
										<option value="2">更新时间</option>
									</select>
								</div>
								<div class="selectDate top_module">
									<table-select-date [notInit]='true' (outerTime)="getSelectTableTime2($event)" ></table-select-date>
								</div>
								<button type="button" class="btn btn-primary" (click)="table_search()">查询</button>
								<button type="button" class="btn btn-primary" (click)="dataExceport()">导出</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="offline.searchKey" (change)="table_search()" class="search-input" placeholder="车牌,设备ID...">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						
						<div class="tabbable">
							<ul class="nav nav-tabs" id="myTab" style="padding-left:12px;background-image: linear-gradient(#F1F5FD, #E9F0FF);">
								<li class="active s-lis"><a data-toggle="tab" href="#deviceOffline" (click)="tabChange('deviceOffline');">设备离线 </a></li>
								<li class="s-lis"><a data-toggle="tab" href="#gpsError" (click)="tabChange('gpsError');">GPS异常 </a></li>
							</ul>
							<div class="tab-content" style="padding:0;border:none">
								<div id="deviceOffline" class="tab-pane active">
									<div class="table_scroll">
										<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
											<thead>
												<tr>
													<th>所属公司</th>
													<th>车牌号码</th>
													<th>设备ID</th>
													<th>地磅数</th>
													<th>离线时间</th>
													<th>离线时长</th>
													<th>安装时间</th>
													<th>司机电话</th>
													<th>司机姓名</th>
												</tr>
											</thead>
											<tbody>
												<tr *ngFor="let row of resultTableData; let i = index">
													<td>{{row.companyName}}</td>
													<td>{{row.carNumber}}</td>
													<td>{{row.deviceId}}</td>
													<td>{{row.weightCount}}</td>
													<td>{{row.carUploadDate}}</td>
													<td>{{row.offlineSecond}}</td>
													<td>{{row.inputDate}}</td>
													<td>{{row.phone}}</td>
													<td>{{row.driverName}}</td>
												</tr>
											</tbody>
										</table>
									</div>
									<div class="table-fix clearfix">
										<paginator [totalRecords]="totalCount"
									           [rows]="pageSize"
									           [currentPage]="curPage - 1"
									           (onPageChange)="paginate($event)">
										</paginator>
										<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
									</div>
								</div>
								<div id="gpsError" class="tab-pane">
									<div class="table_scroll">
										<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
											<thead>
												<tr>
													<th>所属公司</th>
													<th>车牌号码</th>
													<th>设备ID</th>
													<th>重量时间</th>
													<th>GPS时间</th>
													<th>异常时长</th>
													<th>安装时间</th>
													<th>司机电话</th>
													<th>司机姓名</th>
												</tr>
											</thead>
											<tbody>
												<tr *ngFor="let row of resultTableData; let i = index">
													<td>{{row.companyName}}</td>
													<td>{{row.carNumber}}</td>
													<td>{{row.deviceId}}</td>
													<td>{{row.carUploadDate}}</td>
													<td class="red">{{row.gpsUploadDate}}</td>
													<td>{{row.offlineSecond}}</td>
													<td>{{row.inputDate}}</td>
													<td>{{row.phone}}</td>
													<td>{{row.driverName}}</td>
												</tr>
											</tbody>
										</table>
									</div>
									<div class="table-fix clearfix">
										<paginator [totalRecords]="totalCount"
									           [rows]="pageSize"
									           [currentPage]="curPage - 1"
									           (onPageChange)="paginate($event)">
										</paginator>
										<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
									</div>
								</div>
							</div>
						</div>
						
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
</div>
